<template>
  <div class="loading" v-if="isLoading" @click="btnclick">
    <div class="bg">
      <img src="@/assets/img/home/full-screen-loading.gif" alt="" />
    </div>
  </div>
</template>

<script setup>
import useMainstore from "@/stores/modules/main";
import { storeToRefs } from "pinia";
const mainStore = useMainstore();
const { isLoading } = storeToRefs(mainStore);

const btnclick = () => {
  mainStore.isLoading = false;
};
</script>

<style lang="less" scoped>
.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background-color: rgba(0, 0, 0, 0.5);

  display: flex;
  justify-content: center;
  align-items: center;

  .bg {
    width: 104px;
    height: 104px;
    background-image: url("@/assets/img/home/loading-bg.png");
    background-position: 0 0;
    background-size: 100% 100%;

    display: flex;
    justify-content: center;
    align-items: center;

    img {
      width: 70px;
      height: 70px;
    }
  }
}
</style>
